class Solution
{
public:
    vector<vector<int>> findPrimePairs(int n)
    {
        vector<bool> isPrime(n + 1, true);
        isPrime[0] = isPrime[1] = false;

        for (int i = 2; i < n; ++i)
        {
            if (isPrime[i])
            {
                for (int j = i; j * static_cast<long long>(i) <= n; ++j)
                {
                    isPrime[j * i] = false;
                }
            }
        }

        vector<vector<int>> result;
        for (int x = 2; x <= n && x <= n - x; ++x)
        {
            int y = n - x;
            if (isPrime[x] && isPrime[y])
            {
                result.push_back({x, y});
            }
        }

        return result;
    }
};